package com.njtcedu.microblog.common.web.tag;

import java.io.IOException;
import org.springframework.context.ApplicationContext;
import org.springframework.web.servlet.tags.RequestContextAwareTag;
import com.njtcedu.microblog.common.web.setting.CDNSettings;

public abstract class TagSupport extends RequestContextAwareTag {

	protected CDNSettings cdnSettings;

	protected ApplicationContext ctx;

	protected String scheme;

	@Override
	protected int doStartTagInternal() throws Exception {
		this.ctx = this.getRequestContext().getWebApplicationContext();
		cdnSettings = ctx.getBean(CDNSettings.class);
		return startTag();
	}
	
	protected void getNFSHosts() throws IOException {
		pageContext.getOut().print(cdnSettings.getNfsHosts());
	}
	
	protected void getCNDHosts() throws IOException {
		pageContext.getOut().print(cdnSettings.getCdnHosts());
	}
	
	protected abstract int startTag() throws Exception;
}
